-
Notifications
You must be signed in to change notification settings - Fork 6
fix: readd lost custom errors #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
Reviewer's GuideThis pull request re-introduces three custom exception classes ( Class diagram for new exception typesclassDiagram
ValueError <|-- InputUriError
note for InputUriError "Added in this PR"
ValueError <|-- IPDistanceCalculationError
note for IPDistanceCalculationError "Added in this PR"
ValueError <|-- TesUriError
note for TesUriError "Added in this PR"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Nidhi091999 - I've reviewed your changes - here's some feedback:
Overall Comments:
- Please fill out the PR description with details about the motivation for these new exceptions and reference any related issues.
- The exceptions dictionary entries should maintain consistency - TesUriError and IPDistanceCalculationError are missing HTTP status codes while other entries have them.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@@ -94,4 +102,14 @@ class InvalidMiddleware(MiddlewareException): | |||
"message": "Middleware is invalid.", | |||
"code": "500", | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: Missing error code for TesUriError and IPDistanceCalculationError exceptions
Other exceptions in the dictionary include both 'message' and 'code' fields. Consider adding appropriate error codes to maintain consistency in error handling.
493e0f4
to
b6c2e6d
Compare
Let's get to this after the repo is fixed again (broken tests) and after #184 is merged :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Nidhi091999 - I've reviewed your changes - here's some feedback:
- Consider inheriting the new custom exceptions from a shared base exception class specific to this application for better error categorization.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :) Just two very small points on sorting the exceptions.
In fact, next to sorting by error code, you can also sort the exceptions by name, to make it even more tidy and easier to maintain. You can do that in the dictionary (code first, then name, exception: Exception
), and in the exception class definitions (name only).
pro_tes/exceptions.py
Outdated
@@ -94,4 +106,16 @@ class InvalidMiddleware(MiddlewareException): | |||
"message": "Middleware is invalid.", | |||
"code": "500", | |||
}, | |||
InputUriError: { | |||
"message": "Input URI cannot be parsed.", | |||
"code": "400", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please sort the exceptions in this dictionary by the error code, in increasing order. The only exception is the very first exception Exception
- please leave there where it is.
pro_tes/exceptions.py
Outdated
}, | ||
TesUriError: { | ||
"message": "TES URI cannot be parsed", | ||
"code": "400", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, please add it with the other 400
errors
@Nidhi091999: Actually, the tests run on this PR - so perhaps this fixes the integration test issue observed in #186? I propose that you merge this one, update #186 to include the changes in here - and then perhaps we are good? :) |
Issue: #168
Summary by Sourcery
Add
InputUriError
andIPDistanceCalculationError
exceptions, and add aTesUriError
exception.New Features:
InputUriError
for signaling invalid input URIs.IPDistanceCalculationError
for when IP distance calculation fails.TesUriError
for when a TES URI cannot be parsed.Summary by Sourcery
Reintroduce and define custom error classes for specific error scenarios in the exceptions module
New Features:
Bug Fixes: